/**
 * 
 */
package com.alstudio.module.xmpp.request;

import java.util.ArrayList;

import com.alstudio.app.ALLocalEnv;
import com.alstudio.module.ALModuleManager;
import com.alstudio.module.xmpp.protocol.xmpp.data.ALXmppData;
import com.alstudio.module.xmpp.protocol.xmpp.data.VauthData;
import com.alstudio.module.xmpp.protocol.xmpp.packact.ALMessage;
import com.alstudio.pojo.module.local.Prop;
import com.alstudio.pojo.module.user.User;
import com.alstudio.utils.notification.SystemSettings;

/**
 * 
 * 快捷生成UI请求IQ事件
 * 
 * @author alonso lee
 * 
 */
public class ALUiXmppRequestCreator {

	// 添加关注
	public final static int REQUEST_ADD_USER_FAVORITES = 0;
	// 取消收藏
	public final static int REQUEST_DELETE_USER_FAVORITES = 0;
	// 删除粉丝
	public final static int REQUEST_DELET_USER_FANS = 1;

	// 添加特别关注
	public final static int REQUEST_ADD_USER_SPECIAL_FAVORITES = 2;
	// 取消特别关注
	public final static int REQUEST_DELETE_USER_SPECIAL_FAVORITES = 3;

	// 加入黑名单
	public final static int REQUEST_ADD_USER_TO_BLACKLIST = 0;
	// 移除黑名单
	public final static int REQUEST_DELETE_USER_FROM_BLACKLIST = 1;

	// 请求rmb充值金额
	public final static String REQUEST_RECHARGE_TYPE_RMB = "rmb";
	// 请求dollar充值金额
	public final static String REQUEST_RECHARGE_TYPE_DOLLAR = "dollar";

	// 请求所有账单记录
	public final static String REQUEST_ALL_MONEY_HISTORY = "all";
	// 请求消费记录
	public final static String REQUEST_CONSUME_HISTORY = "consume";
	// 请求充值记录
	public final static String REQUEST_RECHARGE_HISTORY = "charge";
	// 请求奖励记录
	public final static String REQUEST_AWARD_HISTORY = "award";

	// 请求与陌生人的通话记录
	public static final int CHECK_VOIP_RECORD_STRANGER = 0;
	// 请求与好友的通话记录
	public static final int CHECK_VOIP_RECORD_FRIENDS = 1;
	// 请求爆米花通话记录
	public static final int CHECK_VOIP_RECORD_BAOMIHUA = 2;
	// 请求拨打普通电话
	public static final int MAKE_NORMAL_CALL = 0;
	// 请求拨打爆米花电话
	public static final int MAKE_BAOMIHUA_CALL = 1;

	/**
	 * 创建UI请求XMPP事件
	 * 
	 * @param type
	 * @param data
	 * @return
	 */
	public synchronized static ALUiXmppRequestEvent creatorALUiXmppEvent(
			ALUiXmppRequestType type, Object data) {
		ALUiXmppRequestEvent event = new ALUiXmppRequestEvent();
		event.setRequestTye(type);
		event.setData(data);
		return event;
	}

	/**
	 * 以传入的账号密码为根据,创建快速登陆xmpp服务器事件.
	 * 
	 * @param username
	 * @param password
	 */
	public static void postALUiXmppLoginEvent(String username, String password) {
		ALLocalEnv.getLocalEnv().getMyAccount().setUserName(username);
		ALLocalEnv.getLocalEnv().getMyAccount().setPassWord(password);

		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_LOGIN_REQUEST, null));
	}

	/**
	 * 登出账号
	 */
	public static void postALUiXmppLogOutEvent() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_LOGOUT_REQUEST, null));
	}

	/******************************** 发现 排行榜 *************************************************/

	/**
	 * 产生请求更多的xmpp事件
	 * 
	 * @param type
	 * @param startIndex
	 * @param endIndex
	 */
	public static void postALUiXmppLoadMoreEvent(ALUiXmppRequestType type,
			String startIndex, String endIndex, String plugin) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();

		data.setStartIndex(startIndex);
		data.setEndIndex(endIndex);
		data.setStrData1(plugin);
		ALUiXmppRequestEvent event = ALUiXmppRequestCreator
				.creatorALUiXmppEvent(type, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求排行榜
	 * 
	 * @param startIndex
	 * @param endIndex
	 * @param type
	 *            0表示魅力榜、1表示富豪榜、2表示女神帮
	 */
	public static void postALUiXmppGetRankListEvent(String startIndex,
			String endIndex, int type) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();

		data.setStartIndex(startIndex);
		data.setEndIndex(endIndex);
		data.setIntData(type);
		ALUiXmppRequestEvent event = ALUiXmppRequestCreator
				.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GET_RANK_REQUEST, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求排行榜
	 * 
	 * @param startIndex
	 * @param endIndex
	 * @param type
	 *            0表示魅力榜、1表示富豪榜、2表示女神帮
	 */
	public static void postALUiXmppGetRankingRankEvent() {
		ALUiXmppRequestEvent event = ALUiXmppRequestCreator
				.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GET_RANKING_RANK_RQEUST, null);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/******************************** 用戶相關操作 ****************************************/

	/**
	 * 请求全站搜索
	 * 
	 * @param startIndex
	 * @param endIndex
	 * @param type
	 * @param keyword
	 */
	public static void postALUiXmppGlobalSearchEvent(String startIndex,
			String endIndex, String type, String keyword) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();

		data.setStartIndex(startIndex);
		data.setEndIndex(endIndex);
		data.setStrData1(keyword);
		data.setStrData2(type);
		ALUiXmppRequestEvent event = ALUiXmppRequestCreator
				.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GLOBAL_SEARCH_REQUEST, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求用户资料，当jid为空是为请求自己的资料
	 * 
	 * @param jid
	 */
	public static void postALUIXmppGetUserProfileEvent(String jid) {
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(
				ALUiXmppRequestType.XMPPP_GET_USER_PROFILE_REQUEST, jid);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求修改个人资料
	 * 
	 * @param u
	 */
	public static void postALUiXmppModifyUserProfileEvent(User u) {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_MODIFY_USER_PROFILE_REQUEST,
								u));
	}

	/**
	 * 请求提交语音介绍
	 * 
	 * @param url
	 * @param len
	 */
	public static void postALUiXmppCommitVoiceIntroEvent(String url, String len) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setStrData1(url);
		data.setStrData2(len);
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_SET_VOICE_INTRO_REQUEST,
								data));
	}

	/**
	 * 请求获取好友、粉丝列表
	 * 
	 * @param type
	 *            0标示获取好友，1标示获取粉丝
	 * @param startIndex
	 * @param endIndex
	 */
	public static void postALUiXmppLoadFriendsListEvent(int type,
			String startIndex, String endIndex) {

		ALUiXmppRequestData data = new ALUiXmppRequestData();

		data.setStartIndex(startIndex);
		data.setEndIndex(endIndex);
		data.setIntData(type);

		ALUiXmppRequestEvent event = creatorALUiXmppEvent(
				ALUiXmppRequestType.XMPPP_GET_FRIEND_LISTS_REQUEST, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求删除好友或者粉丝
	 * 
	 * @param type
	 *            0标示删除好友，1标示删除粉丝
	 * @param jid
	 *            待删除用户
	 */
	public static void postALUiXmppDeleteFriendOrFans(int type, String jid) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();

		data.setStrData1(jid);
		data.setIntData(type);

		ALUiXmppRequestEvent event = creatorALUiXmppEvent(
				ALUiXmppRequestType.XMPPP_DELETE_FRIEND_OR_FANS_REQUEST, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求服务器处理关注相关操作。支持关注、取消关注、特别关注、取消特别关注
	 * 
	 * @param type
	 *            0 表示添加关注，2表示添加特别关注，3表示取消特别关注
	 * @param jid
	 *            执行相关关注的用户jid
	 */
	public static void postALUiXmppFavoritesFun(int favoriteType, String jid) {
		ALUiXmppRequestType type = null;
		switch (favoriteType) {
		case REQUEST_ADD_USER_FAVORITES:
			// 添加关注
			type = ALUiXmppRequestType.XMPP_ADD_USER_FAVORITES_REQUEST;
			break;
		case REQUEST_ADD_USER_SPECIAL_FAVORITES:
			// 添加特别关注
			type = ALUiXmppRequestType.XMPP_ADD_SPECIAL_FAVORITES_REQUEST;
			break;
		case REQUEST_DELETE_USER_SPECIAL_FAVORITES:
			// 取消特别关注
			type = ALUiXmppRequestType.XMPP_DELETE_SPECIAL_FAVORITES_REQUEST;
			break;
		}
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, jid);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求服务器处理黑名單相关操作。支持加入黑名單，移出黑名單
	 * 
	 * @param type
	 *            0 表示加入黑名單，1表示移出黑名單
	 * @param jid
	 *            执行相关黑名单的用户jid
	 */
	public static void postALUiXmppBlackListFun(int blackListType,
			ArrayList<User> users) {
		ALUiXmppRequestType type = null;
		switch (blackListType) {
		case REQUEST_ADD_USER_TO_BLACKLIST:
			// 加入黑名单
			type = ALUiXmppRequestType.XMPP_ADD_USER_TO_BLACK_LIST_REQUEST;
			break;
		case REQUEST_DELETE_USER_FROM_BLACKLIST:
			// 移出黑名单
			type = ALUiXmppRequestType.XMPP_DELETE_USER_TO_BLACK_LIST_REQUEST;
			break;
		}
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, users);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求黑名单列表
	 * 
	 * @param startIndex
	 *            数据起始点
	 * @param endIndex
	 *            数据结束点
	 */
	public static void postALUiXmppGetUserBlackList() {
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(
				ALUiXmppRequestType.XMPP_CHECK_BLACK_LIST_REQUEST, null);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求相互关注列表
	 * 
	 * @param startIndex
	 *            数据起始点
	 * @param endIndex
	 *            数据结束点
	 */
	public static void postALUiXmppGetUserSpecialFavorites(String startIndex,
			String endIndex) {
		postALUiXmppLoadMoreEvent(
				ALUiXmppRequestType.XMPP_CHECK_FAVORITES_EACH_OTHER_REQUEST,
				startIndex, endIndex, null);
	}

	/******************************** 賬號設置 *************************************************/

	/**
	 * 请求更改密码
	 * 
	 * @param oripassword
	 *            原密碼
	 * @param password
	 *            新密碼
	 */
	public static void postALUiChangePassword(String oripassword,
			String password) {
		ALUiXmppRequestType type = ALUiXmppRequestType.XMPP_CHANGE_PASSWORD_REQUEST;
		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setStrData1(oripassword);
		data.setStrData2(password);
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求提交用户配置文件
	 * 
	 * @param settings
	 *            用户配置文件
	 */
	public static void postALUiXmppCommitUserOpt(SystemSettings settings) {
		ALUiXmppRequestType type = ALUiXmppRequestType.XMPP_COMMIT_USER_OPTION_REQUEST;
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, settings);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求用户配置文件
	 */
	public static void postALUiXmppGetUserOpt() {
		ALUiXmppRequestType type = ALUiXmppRequestType.XMPP_GET_USER_OPTION_REQUEST;
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, null);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求获取V认证状态
	 */
	public static void postALUiXmppCheckVauthState() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_CHECK_VAUTH_STATE_REQUEST,
						null));
	}

	/**
	 * 请求V认证
	 * 
	 * @param data
	 */
	public static void postALUiXmppStartVauth(VauthData data) {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_START_VAUTH_REQUEST, data));
	}

	/**
	 * 发送反馈事件
	 * 
	 * @param content
	 */
	public static void postALUiXmppFeedBack(String content) {
		ALXmppData data = ALLocalEnv.getLocalEnv().createALXmppData();
		data.setData(content);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_SEND_FEED_BACK_REQUEST, data));
	}

	/**
	 * 举报用户
	 * 
	 * @param jid
	 *            被举报用户的jid
	 * @param reason
	 *            举报原因
	 * @param content
	 *            举报详情
	 */
	public static void postALUiXmppChargeUser(String jid, String reason,
			String content) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setJid(jid);
		data.setStrData1(reason);
		data.setStrData2(content);

		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_ACCUSATION_CHARGE_USER_REQUEST,
								data));
	}

	/**
	 * 绑定邮箱
	 * 
	 * @param email
	 *            新绑定邮箱
	 * @param pwd
	 *            新密码
	 */
	public static void postALUiXmppBindEmail(String email, String pwd) {
		ALXmppData data = new ALXmppData();
		data.setEmail(email);
		data.setPassword(pwd);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_BIND_EMAIL_REQUEST, data));
	}

	/**
	 * 再次绑定邮箱
	 */
	public static void postALUiXmppBindEmailAgain() {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_BIND_EMAIL_AGEIN_REQUEST,
								null));
	}

	/**
	 * 请求设置备注名
	 * 
	 * @param jid
	 *            待设置备注名的用户jid
	 * @param notename
	 *            备注名
	 */
	public static void postALUiXmppSetNoteName(String jid, String notename) {
		ALUiXmppRequestType type = ALUiXmppRequestType.XMPP_SET_USER_NOTENAME_REQUEST;
		ALUiXmppRequestEvent event = new ALUiXmppRequestEvent();
		event.setRequestTye(type);
		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setJid(jid);
		data.setStrData1(notename);
		event.setData(data);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/*********************************** 經濟系統 **********************************************/

	/**
	 * 获取充值价格表
	 * 
	 * @param rechargeType
	 *            充值类型 可选为rmb、dollar
	 */
	public static void postALUiXmppGetRechargePrice(String rechargeType) {
		ALUiXmppRequestType type = ALUiXmppRequestType.XMPP_GET_RECHARGE_PRICE_REQUEST;
		ALUiXmppRequestEvent event = creatorALUiXmppEvent(type, rechargeType);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				event);
	}

	/**
	 * 请求账单，分段请求
	 * 
	 * @param startIndex
	 *            数据起始点
	 * @param endIndex
	 *            数据结束点
	 * @param type
	 *            请求的消费记录类型，支持consume/charge/award/all
	 */
	public static void postALUiXmppGetUserMoneyHistory(String startIndex,
			String endIndex, String type) {
		postALUiXmppLoadMoreEvent(
				ALUiXmppRequestType.XMPP_GET_MONEY_HISTORY_REQUEST, startIndex,
				endIndex, type);
	}

	/**
	 * 请求清空账单
	 */
	public static void postALUiXmppClearUserMoneyHistory() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_DELETE_MONEY_HISTORY_REQUEST,
						null));
	}

	/**
	 * 请求用户积分
	 */
	public static void postALUiXmppGetUserPoints() {

		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_GET_USER_POINTS_REQUEST,
								null));
	}

	/**
	 * 请求清除积分记录
	 */
	public static void postALUiXmppClearPointsHistory() {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_DELETE_USER_POINTS_HISTORY_REQUEST,
								null));
	}

	/**
	 * 请求积分记录
	 * 
	 * @param startIndex
	 *            数据起始点
	 * @param endIndex
	 *            数据结束点
	 */
	public static void postALUiXmppGetUserPointsHistory(String startIndex,
			String endIndex) {
		postALUiXmppLoadMoreEvent(
				ALUiXmppRequestType.XMPP_GET_USER_POINTS_HISTORY_REQUEST,
				startIndex, endIndex, null);
	}

	/**************************************************************** voip *************************************************************************/
	/**
	 * 请求进入爆米花
	 */
	public static void postALUiXmppEnterBaoMiHua(String sex) {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_ENTER_BAO_MI_HUA_REQUEST,
								sex));
	}

	/**
	 * 请求退出爆米花
	 */
	public static void postALUiXmppExitBaoMiHua() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_EXIT_BAO_MI_HUA_REQUST, null));
	}

	/**
	 * 请求进入邂逅
	 */
	public static void postALUiXmppXiehou() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_ENTER_XIE_HOU_REQUEST, null));
	}

	/**
	 * 请求拨打电话
	 * 
	 * @param jid
	 *            被呼叫用户jid
	 * @param type
	 *            呼叫类型 MAKE_NORMAL_CALL标示普通呼叫，MAKE_BAOMIHUA_CALL标示爆米花呼叫
	 */
	public static void postALUiXmppMakeCall(String jid, int type) {

		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setJid(jid);
		data.setIntData(type);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_MAKE_CALL_REQUEST, data));
	}

	/**
	 * 请求挂断电话
	 * 
	 * @param sessionId
	 */
	public static void postALUiXmppHandupCall(String sessionId) {

		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator
						.creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_HANDUP_CALL_REQUEST,
								sessionId));
	}

	/**
	 * 请求拒绝电话
	 * 
	 * @param sessionId
	 */
	public static void postALUiXmppRejectCall(String sessionId) {

		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_REJECT_INCOMMING_CALL_REQUEST,
						sessionId));
	}

	/**
	 * 请求接听电话
	 * 
	 * @param sessionId
	 */
	public static void postALUiXmppAcceptCall(String sessionId) {

		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_ACCEPT_INCOMMING_CALL_REQUEST,
						sessionId));
	}

	/**
	 * 
	 * @param type
	 *            请求类型 请求与陌生人的通话记录 CHECK_VOIP_RECORD_STRANGER = 0; 请求与好友的通话记录
	 *            CHECK_VOIP_RECORD_FRIENDS = 1; 请求爆米花通话记录
	 *            CHECK_VOIP_RECORD_BAOMIHUA = 2;
	 * @param startIndex
	 * @param endIndex
	 */
	public static void postALUiXmppCheckVoipRecord(int type, String startIndex,
			String endIndex) {
		ALUiXmppRequestData data = new ALUiXmppRequestData();
		data.setStartIndex(startIndex);
		data.setEndIndex(endIndex);
		data.setIntData(type);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_CHECK_VOIP_RECORD_REQUEST,
						data));
	}

	/**
	 * 请求更新通话时间
	 * 
	 * @param sessionId
	 */
	public static void postALUiXmppVoipCharge(String sessionId) {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_VOIP_UPDATE_CALLING_TIME_REQUEST,
								sessionId));
	}

	/**
	 * 请求通话价格列表
	 * 
	 */
	public static void postALUiXmppVoipCheckCallPrice() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GET_VOIP_CALL_PRICE_REQUEST,
						null));
	}

	/**
	 * 更新通话价格
	 * 
	 * @param price
	 */
	public static void postALUiXmppVoipSetCallPrice(String price) {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_SET_VOIP_CALL_PRICE_REQUEST,
						price));
	}

	/**
	 * 请求通话详情
	 * 
	 * @param jid
	 */
	public static void postALUiXmppVoipCheckHistoryDetail(String jid,
			String startIndex, String endIndex) {

		postALUiXmppLoadMoreEvent(
				ALUiXmppRequestType.XMPP_CHECK_CALL_HISTORY_DETAIL_REQUEST,
				startIndex, endIndex, jid);
	}

	/**
	 * 请求删除通话详情
	 * 
	 * @param jid
	 */
	public static void postALUiXmppVoipDeleteCallHistoryDetail(String jid) {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						creatorALUiXmppEvent(
								ALUiXmppRequestType.XMPP_DELETE_CALL_HISTORY_DETAIL_REQUEST,
								jid));
	}

	/************************************** 道具系统 *****************************************************/
	/**
	 * 请求获取道具商城道具列表
	 */
	public static void postALUiXmppCheckPropsList() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GET_PROPS_LIST_REQUEST, null));
	}

	/**
	 * 请求获取道具价格列表
	 */
	public static void postALUiXmppCheckPropsPrice(String prop) {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						ALUiXmppRequestCreator
								.creatorALUiXmppEvent(
										ALUiXmppRequestType.XMPP_GET_PROPS_PRICE_REQUEST,
										prop));
	}

	/**
	 * 请求获取用户道具列表
	 */
	public static void postALUiXmppCheckUserPropsList() {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_GET_USER_PROPS_REQUEST, null));
	}

	/**
	 * 请求获取用户道具购买明细
	 */
	public static void postALUiXmppCheckUserBuyPropsHistory() {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						ALUiXmppRequestCreator
								.creatorALUiXmppEvent(
										ALUiXmppRequestType.XMPP_GET_USER_PROPS_HISTORY_REQUEST,
										null));
	}

	/**
	 * 请求清除用户道具购买明细
	 */
	public static void postALUiXmppDeleteUserBuyPropsHistory() {
		ALModuleManager
				.getDefaultModuleManager()
				.postEventToModuleManager(
						ALUiXmppRequestCreator
								.creatorALUiXmppEvent(
										ALUiXmppRequestType.XMPP_DELETE_USER_PROPS_HISTORY_REQUEST,
										null));
	}

	/**
	 * 请求激活道具
	 */
	public static void postALUiXmppActiveProps(Prop prop) {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_ACTIVE_PROPS_REQUEST, prop));
	}

	/************************************ message消息处理 *****************************************/
	/**
	 * 请求发送语音留言到指定用户
	 * 
	 * @param user
	 * @param fileid
	 */
	public static void postALUiXmppSendAudioLeaveMessage(User user,
			String fileid) {

		ALMessage msg = ALLocalEnv.getLocalEnv().createMessage(user,
				ALMessage.AUDIO_LEAVE);
		msg.setFileId(fileid);
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_SEND_MESSAGE_REQUEST, msg));
	}

	/**
	 * 请求发送聊天消息到指定用户
	 * 
	 * @param msg
	 */
	public static void postALUiXmppSendMessage(ALMessage msg) {
		ALModuleManager.getDefaultModuleManager().postEventToModuleManager(
				ALUiXmppRequestCreator.creatorALUiXmppEvent(
						ALUiXmppRequestType.XMPP_SEND_MESSAGE_REQUEST, msg));
	}

}
